package cn.gailvlun.gll.presentation.hotel.drawer

import android.content.Context
import android.content.Intent
import android.databinding.DataBindingUtil
import android.os.Bundle
import cn.gailvlun.gll.R
import cn.gailvlun.gll.databinding.ActivityHotelMyShareBinding
import cn.gailvlun.gll.presentation.base.BaseActivity



class HotelMyShareActivity : BaseActivity() {

    companion object {
        fun openActivity(context: Context, isText: Boolean = true) {
            val intent = Intent(context, HotelMyShareActivity::class.java)
            intent.putExtra("isText", isText)
            context.startActivity(intent)
        }
    }

    private lateinit var mBinding: ActivityHotelMyShareBinding
    private lateinit var mAdapter: HotelSharePagerAdapter

    override fun initComponent() {
        mBinding = DataBindingUtil.setContentView(this, R.layout.activity_hotel_my_share)

        mAdapter = HotelSharePagerAdapter(supportFragmentManager)
        mBinding.vp.adapter = mAdapter

        mBinding.stl.setViewPager(mBinding.vp)
    }

    override fun createHandler() {
        mBinding.nbv.setOnBackListener { onBackPressed() }
    }

    override fun loadData(savedInstanceState: Bundle?) {
        val isText = intent.getBooleanExtra("isText", true)


        takeUnless { isText }?.apply { mBinding.vp.currentItem = 1 }

    }
}
